package com.wntms.zjy.dao;

import com.wntms.zjy.pojo.CustomerReply;
import com.wntms.zjy.pojo.FreightContract;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author xzbz
 * @create 2022-11-22 14:58
 */
@Mapper
public interface CustomerReplyDaoz {
    @Results({
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "noticeContent",column = "notice_content"),
            @Result(property = "noticeTime",column = "notice_time"),
            @Result(property = "issuccess",column = "issuccess"),
            @Result(property = "notifier",column = "notifier"),

            @Result(property = "fid",column = "fid"),
            /**/
            @Result(property = "fc",column = "fid",javaType = FreightContract.class,one = @One(select = "com.wntms.zjy.dao.FreightContractDaoz.findById"))
    })
    @Select("select * from customer_recevie")
    public List<CustomerReply> findAll();


    @Insert("insert into customer_recevie values(#{id},#{fid},#{noticeContent},#{noticeTime},true,#{notifier})")
    public int addNewReply(CustomerReply customerReply);

    @Delete("delete from customer_recevie where id = #{id}")
    public int deleteReply(Integer id);

    @Results({
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "noticeContent",column = "notice_content"),
            @Result(property = "noticeTime",column = "notice_time"),
            @Result(property = "issuccess",column = "issuccess"),
            @Result(property = "notifier",column = "notifier"),

            @Result(property = "fid",column = "fid"),
            /**/
            @Result(property = "fc",column = "fid",javaType = FreightContract.class,one = @One(select = "com.wntms.zjy.dao.FreightContractDaoz.findById"))
    })
    @Select("select * from customer_recevie where fid = #{fid}")
    public CustomerReply findByFid(String fid);


}
